package sms

import (
	"gitee.com/wuzheng0709/backend-gopkg/infrastructure/config"
	"github.com/aliyun/alibaba-cloud-sdk-go/services/dysmsapi"
)

func SendSms(phone string, infoType string, value string, template string, signame string) (response *dysmsapi.SendSmsResponse, err error) {
	client, err := dysmsapi.NewClientWithAccessKey("cn-hangzhou", config.C.Sms.AccessKeyId, config.C.Sms.AccessKeySecret)
	request := dysmsapi.CreateSendSmsRequest()
	request.PhoneNumbers = phone
	request.TemplateCode = template //config.C.Sms.TemplateCode
	request.TemplateParam = "{\"" + infoType + "\":\"" + value + "\"}"
	request.SignName = signame // "数字土木平台"
	response, err = client.SendSms(request)
	return
}
